package day1;

import java.util.Iterator;
import java.util.Scanner;
import java.util.Stack;

public class Day1_03 {
    /*错误
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        StringBuilder str = new StringBuilder(in.next());

        for(int i = 0; i < str.length() - 1; ) {
            //只有两个字母且相等
            *//*if(i == 0 && str.charAt(i) == str.charAt(i+1)) {
                System.out.println(0);
                return;
            }*//*
            //其他情况两个字母相等
            if(str.charAt(i) == str.charAt(i+1)) {
                String temp1 =  str.substring(0,i);
                String temp2 =  str.substring(i+2);
                str  = new StringBuilder("");
                str.append(temp1);
                str.append(temp2);
                if(i != 0) i--;
                continue;
            }
            i++;
        }
        if(str.toString().equals("")) {
            System.out.println(0);
            return;
        }
        System.out.println(str.toString());
    }*/
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.next();

        StringBuilder ret = new StringBuilder("");
        for(int i = 0; i <str.length(); i++) {
            char ch = str.charAt(i);
            if(ret.length() != 0 && ch == ret.charAt(ret.length()-1) ) {
                //出栈
                ret.deleteCharAt(ret.length()-1);
            } else {
                //进栈
                ret.append(str.charAt(i));
            }
        }
        //注意判断栈是否为空
        System.out.println(ret.length() == 0? 0 : ret.toString());
    }
}
//https://www.nowcoder.com/practice/8d3643ec29654cf8908b5cf3a0479fd5?tpId=308&tqId=40462&ru=/exam/oj